<%@page import="com.project.db.SQLHelper"%>
<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%
	Cookie[] cookie = request.getCookies();
	String id="";
	for (Cookie c : cookie) {
		if (c.getName().equals("userid")) {
	id = c.getValue();
		}
	}
	String username = SQLHelper.getName(id);
%>
<html lang="zh-cn">
<head>
<meta charset="utf-8" />
<meta name="viewport"
	content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<link href="css/app-resume.css" rel="stylesheet">
</head>
<body>
	<nav>
	<div style="width: 100%; height: 5px; background-color: #444;"></div>
	<div class="container">
		<div class="tran">My Resume</div>
		<ul>
			<li><p>
					<%=username%>，你好。 <a href="/personal.jsp">个人中心</a>
				</p></li>
			<li><a href="http://offerproject.jd-app.com/">退出</a></li>
		</ul>
	</div>
	</nav>
	<div class="container" style="margin-top: 50px;">
		<h3 style="line-height: 35px; font-size: 16px; font-weight: bold;">>编辑我的简历/My
			Resume</h3>
		<div class="edit-item">
			<ul>
				<li><span>姓名：</span><input type="text" name="name"></li>
				<li><span>年龄：</span><input type="text" name="age"></li>
				<li><span>性别：</span>男<input type="radio" checked="checked"
					name="sex" value="man"> 女<input type="radio" name="sex"
					value="woman"></li>
				<li><span>毕业学校：</span><input type="text" name="college"></li>
				<li><span>专业：</span><input type="text" name="subject"></li>
				<li><span>手机号码：</span><input type="text" name="phone"></li>
				<li><span>邮箱：</span><input type="text" name="email"></li>
				<li><span style="vertical-align: top;">个人描述：</span> <textarea
						style="width: 380px; height: 180px;"></textarea></li>
			</ul>
			<span class="btn" onclick="submitResume();">提交简历</span>
		</div>
	</div>
	<script src="js/jquery.min.js"></script>
	<script type="text/javascript">
		function submitResume() {
			var _name = $("input[name='name']").val();
			var _age = $("input[name='age']").val();
			var _sex = $("input[name='sex']:checked").val();
			var _college = $("input[name='college']").val();
			var _subject = $("input[name='subject']").val();
			var _phone = $("input[name='phone']").val();
			var _email = $("input[name='email']").val();
			var _descibe = $("textarea").val().trim();
			$.post("/addResumeAction", {
				name : _name,
				age : _age,
				sex : _sex,
				college : _college,
				subject : _subject,
				phone : _phone,
				email : _email,
				describe : _descibe
			}, function(data, state) {
				if (data == "0") {
					alert("编辑失败，刷新后重试");
				} else {
					alert("编辑成功！");
					location.href = "/personal.jsp";
				}
			}).error(function() {
				alert("未知错误，刷新后请重试");
				location.reload();
			})
		}
	</script>
</body>
</html>